
package com.micro.school.system.convert.student;

import com.micro.school.system.domain.BatchLogDetail;
import com.micro.school.system.domain.vo.BatchLogDetailVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface BatchLogDetailConvert {

    public static BatchLogDetailVo toVo(BatchLogDetail entity) {
        if (entity == null) {
            return null;
        }

        BatchLogDetailVo vo = new BatchLogDetailVo();
        vo.setId(entity.getId());
        vo.setBatchId(entity.getBatchId());
        vo.setName(entity.getName());
        vo.setSex(entity.getSex());
        vo.setPhone(entity.getPhone());
        vo.setIdNumber(entity.getIdNumber());
        vo.setCollegeName(entity.getCollegeName());
        vo.setEducation(entity.getEducation());
        vo.setMajorName(entity.getMajorName());
        vo.setGradeName(entity.getGradeName());
        vo.setClassName(entity.getClassName());
        vo.setSignTime(entity.getSignTime());
        vo.setSchoolSystem(entity.getSchoolSystem());
        vo.setStatus(entity.getStatus());
        vo.setErrorMessage(entity.getErrorMessage());
        // 注意：BatchLogDetail 中没有 tenantId 字段，所以这里省略
        return vo;
    }

    public static BatchLogDetail toEntity(BatchLogDetailVo vo) {
        if (vo == null) {
            return null;
        }

        BatchLogDetail entity = new BatchLogDetail();
        entity.setId(vo.getId());
        entity.setBatchId(vo.getBatchId());
        entity.setName(vo.getName());
        entity.setSex(vo.getSex());
        entity.setPhone(vo.getPhone());
        entity.setIdNumber(vo.getIdNumber());
        entity.setCollegeName(vo.getCollegeName());
        entity.setEducation(vo.getEducation());
        entity.setMajorName(vo.getMajorName());
        entity.setGradeName(vo.getGradeName());
        entity.setClassName(vo.getClassName());
        entity.setSignTime(vo.getSignTime());
        entity.setSchoolSystem(vo.getSchoolSystem());
        entity.setStatus(vo.getStatus());
        entity.setErrorMessage(vo.getErrorMessage());
        return entity;
    }

    public static List<BatchLogDetailVo> toVoList(List<BatchLogDetail> entityList) {
        if (entityList == null) {
            return null;
        }

        List<BatchLogDetailVo> voList = new ArrayList<>();
        for (BatchLogDetail entity : entityList) {
            voList.add(toVo(entity));
        }
        return voList;
    }

    public static List<BatchLogDetail> toEntityList(List<BatchLogDetailVo> voList) {
        if (voList == null) {
            return null;
        }

        List<BatchLogDetail> entityList = new ArrayList<>();
        for (BatchLogDetailVo vo : voList) {
            entityList.add(toEntity(vo));
        }
        return entityList;
    }
}
